package com.zd.springcloud.order.service.impl;


import com.zd.springcloud.domain.Order;
import com.zd.springcloud.order.mapper.OrderMapper;
import com.zd.springcloud.order.service.OrderService;

import io.seata.core.context.RootContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderMapper orderMapper;

    @Override
    public void addOrder(Order order) {
<<<<<<< HEAD:springcloud-nacos-order/src/main/java/com/zd/springcloud/service/impl/OrderServiceImpl.java
=======
        System.out.println(RootContext.inGlobalTransaction());
        System.out.println(RootContext.getXID());
        System.out.println(RootContext.getBranchType());
        //这里模拟出现错误，然后和实现熔断降级
        int i = 10 / 0;

>>>>>>> a78a59f7e9652635f56bbcd587409434b2c8ef12:springcloud-nacos-order/src/main/java/com/zd/springcloud/order/service/impl/OrderServiceImpl.java
        orderMapper.addOrder(order);

    }
}
